This application relates to a method and apparatus for a user interface control and, specifically, to a method and apparatus that allows a user to display graphics without using a complex windowing system.
Systems that have embedded programs, such as certain information appliances and consumer products, often do not contain general purpose windowing or window management software. In these systems, all graphics are generally done via calls to the built-in graphics routines, such as draw-line, draw rectangle, etc. In many conventional systems, graphics are drawn via interaction with the browser. Thus, if multiple applets are executing as different threads in the browser, they will experience a lack of concurrency when performing graphics operations.
A described embodiment of the present invention implements a separate child context for each applet (or similar browser element). A described embodiment of the present invention provides one or more child contexts that correspond to elements in the HTML for a web page displayed by a browser. For example, each applet executed by the browser has a corresponding and separate child context where each child context has a corresponding portion of browser memory mapped thereto. The browser also has a parent context, which each child context points to. When a graphic is displayed via a widget, the widget draws the graphic (such as a panel or a non-pressed button) in the child context of the applet and sets a xe2x80x9cdamagexe2x80x9d flag in the child context. When the browser performs its main browser loop, it checks the status of the damaged flag for each element (including each applet). If the browser finds a damage flag that is set, this means that something was written into that portion of the browser memory mapped to that child context and that the parent buffer needs updating. In this case, the browser xe2x80x9cpullsxe2x80x9d the information from that portion of memory mapped to the child context and into the parent buffer, which is then used to update the display screen. Thus, several separate threads in the JVM can be executing concurrently and updating graphics elements without interfering with each other.
The invention extends the graphics library routines to include (at least) routines to set up, delete, read, and modify child contexts and to copy information from child contexts to parent contexts. The widget library routines are extended to include (at least) a parameter identifying the context currently being worked on.
Reactive components present special problems. Reactive components are defined as components that must display interactive behavior. For example, when a user clicks on a button on the display screen, the button is momentarily displayed as xe2x80x9cpressedxe2x80x9d and soon thereafter displayed as xe2x80x9creleased.xe2x80x9d Such interactive behavior gives visual feedback to the user. Examples of reactive components include buttons, lists, choice bars, etc. Present special problems. When a widget, for example, a button, needs to show interactive behavior (such as going up and down when pressed), this behavior must occur very rapidlyxe2x80x94often too rapidly to necessarily be picked up by a main browser loop, which executes relatively infrequently. For example, in the described embodiment, the main browser loop executes approximately every 200 milliseconds (i.e., approximately five times per second). In contrast, a xe2x80x9cdownxe2x80x9d button press followed by an xe2x80x9cupxe2x80x9d takes approximately 50 milliseconds. If the system were to wait for the browser loop, the button press would have to last much longer.
In accordance with the purpose of the invention, as embodied and broadly described herein, the invention relates to a method of controlling display of graphics data, comprising: sending a user input event, by a browser to a virtual execution environment; providing, in the virtual execution environment, a child context corresponding to a parent context in the browser and an applet that is executed by the browser; writing directly into a portion of a browser memory associated with the child context, a graphic in accordance with the user input event; pulling, by the browser, the graphic from the portion of a browser memory associated with the child context to the parent context; and displaying the graphic stored in the parent context on a display screen.
A fuller understanding of the invention will become apparent and appreciated by referring to the following description and claims taken in conjunction with the accompanying drawings.